package org.yocastlong.mybatisplus.configuration;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.yocastlong.mybatisplus.handle.HeaderInterceptor;
import org.yocastlong.mybatisplus.service.AuthService;

/**
 * @author 朱海龙
 * 2025/6/10 08:15
 */
@Configuration
public class WebConfiguration implements WebMvcConfigurer {

    @Autowired
    private AuthService authService;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        final HeaderInterceptor headerInterceptor = new HeaderInterceptor(authService);
        registry.addInterceptor(headerInterceptor)
                .addPathPatterns("/**");
    }
}
